import { defHttp } from '@/utils/http/axios';

enum Api {
  GetOrder = '/agent/newPayment/GrabOrderIndex',
  GetReport = '/agent/newPayment/report',
  GrabOrder = '/agent/newPayment/GrabOrderAgent',
  GetReportIndex = '/agent/report/index',
  GetCollectionList = '/agent/newPayment/GrabOrderCheck',
  AddReport = '/agent/report/add',
  GetOrderList = '/agent/reviewOrder/index',
  GetPayment = '/agent/paymentCode/index',
  GetPaymentCount = '/agent/paymentStatistics/index',
  DeletReport = '/agent/report/del',
  EditReport = '/agent/report/edit',
  PaymentReprot = '/agent/report/payment',
  GrabOrderInfo = '/agent/reviewOrder/GrabOrderView',
  Remittance = '/agent/reviewOrder/remittance',
  Reporting = '/agent/reviewOrder/reporting',
  Transfer = '/agent/reviewOrder/transfer',
  CancelOrder = '/agent/reviewOrder/GrabOrderCancel',
  AgentStatus = '/agent/reviewOrder/AgentStatus',
  OrderStatus = '/agent/newPayment/OrderStatus',
}

export function OrderStatusApi() {
  return defHttp.post<any>({
    url: Api.OrderStatus,
  });
}

export function AgentStatusApi(params: { username: string }) {
  return defHttp.post<any>(
    {
      url: Api.AgentStatus,
      params,
    },
    {
      errorMessageMode: 'none',
      isTransformResponse: false,
    },
  );
}

export function CancelOrderApi(params: { orderNo: string }) {
  return defHttp.post<any>({
    url: Api.CancelOrder,
    params,
  });
}

export function TransferApi(params: { orderNo: string; username: string }) {
  return defHttp.post<any>({
    url: Api.Transfer,
    params,
  });
}

export function ReportingApi(params: { orderNo: string; review: string }) {
  return defHttp.post<any>({
    url: Api.Reporting,
    params,
  });
}

export function RemittanceApi(params: {
  orderNo: string;
  agentImgSrc: Array<string>;
  agentRemark: string;
}) {
  return defHttp.post<any>({
    url: Api.Remittance,
    params,
  });
}

export function GrabOrderInfoApi(params: { orderNo: string }) {
  return defHttp.post<any>({
    url: Api.GrabOrderInfo,
    params,
  });
}

export function PaymentReprotApi(params: any) {
  return defHttp.post<any>({
    url: Api.PaymentReprot,
    params,
  });
}

export function EditReportApi(params: any) {
  return defHttp.post<any>({
    url: Api.EditReport,
    params,
  });
}

export const DeletReportApi = (ids: Array<string | number>) => {
  return defHttp.delete({
    url: Api.DeletReport,
    params: {
      ids,
    },
  });
};

export function GetOrderApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetOrder + `?page=${params.page}&limit=${params.pageSize}`,
    params,
  });
}

export function GetReportApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetReport,
    params,
  });
}

export function GrabOrderApi(params: { orderNo: string; review: string }) {
  return defHttp.post<any>({
    url: Api.GrabOrder,
    params,
  });
}

export function GetReportIndexApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetReportIndex + `?page=${params.page}&limit=${params.pageSize}`,
    params,
  });
}
export function GetCollectionListApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetCollectionList,
    params,
  });
}
export function AddReportApi(params: any) {
  return defHttp.post<any>({
    url: Api.AddReport,
    params,
  });
}

export function GetOrderListApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetOrderList,
    params,
  });
}
export function GetPaymentApi() {
  return defHttp.post<any>({
    url: Api.GetPayment,
  });
}

export function GetPaymentCountApi() {
  return defHttp.post<any>({
    url: Api.GetPaymentCount,
  });
}
